FROM ubuntu:22.04

RUN apt-get update \
    && apt-get install curl -y \
    && apt-get install ssh -y \
    && apt-get install openvpn -y \
# 在最后一行行后添加字符串
    && sed -i '$a PermitRootLogin yes' /etc/ssh/sshd_config \
    && sed -i '$a PasswordAuthentication no' /etc/ssh/sshd_config \
    && sed -i '$a AuthorizedKeysFile /vpn/knownn' /etc/ssh/sshd_config \
    && mkdir -p /run/sshd \
    && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* && rm -rf /tmp/*

ADD run.sh /root/run.sh
RUN chmod +x /root/run.sh

# Set environment variables.
# ENV HOME /root

# Define working directory.
WORKDIR /vpn

CMD ["/root/run.sh"]
